package fem2.gui.pm;

import fem2.gui.src.HofemCurvesSource;
import fem2.gui.src.HofemSource;
import inf.vtk.pm.CurvesDP;

import java.beans.PropertyChangeEvent;
import java.util.Arrays;
import java.util.List;

import vtk.vtkPolyData;

public class HofemCurvesDP extends HofemDataProvider implements CurvesDP {

	private HofemCurvesSource curvesSource_ = new HofemCurvesSource();

	public vtkPolyData getControlsData() {
		return curvesSource_.GetPolyDataOutput();
	}

	public vtkPolyData getCurveData() {
		return curvesSource_.GetPolyDataOutput();
	}

	@Override
	protected List<HofemSource> getSources() {
		return Arrays.asList(new HofemSource[] { curvesSource_ });
	}

	public double[] getVectorDataNormRange() {
		return curvesSource_.getVectorDataNormRange();
	}

	@Override
	protected void modelChange(PropertyChangeEvent evt) {
	}

	public boolean providesData() {
		return getCastedModel() != null && getCastedModel().getModel().getMesh().countEdges() > 0;
	}

	public boolean providesSolutionData() {
		return providesData() && getCastedModel().solutionAvailable();
	}

	@Override
	protected void solutionChanged(PropertyChangeEvent p) {
	}
}
